package com.superhelper.common.mapper;

import java.math.BigDecimal;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.superhelper.common.domain.User;

public interface UserMapper {

    @Select("select * from user where phone=#{phone} and auserId=#{auserId} limit 1")
    User getUser(@Param("phone") String phone, @Param("auserId") Integer auserId);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user(auserId,name,phone,mt_money,ele_money,integral,source,createAt) values(#{auserId},#{name},#{phone},#{mt_money},#{ele_money},#{integral},#{source},#{createAt})")
    int insertUser(User user);

    @Update("update user set mt_money=#{mt_money},ele_money=#{ele_money},integral=#{integral} where phone=#{phone} and auserId=#{auserId}")
    int updateUser(User user);

    @Select("select packageName from auser where imid=#{imid}")
    String getPackageNameByImid(@Param("imid") String imid);
}
